#pragma once
#include <string>
#include <memory>
#include <unordered_map>
#include "msgq/msgq_adapter.h"
#include "serializer/msg_serializer.h"

template <typename MsgType>
class Subscriber {
public:
  using SubCallback = std::function<void(const MsgType &)>;

  struct SubscriberInfo {
    int eventfd;
    SubCallback callback_;
  };

  Subscriber(const std::string &topic_name);
  ~Subscriber();

  bool Subscribe(const std::string &topic_name, SubCallback callback);

private:
  std::string topic_name_;
  std::shared_ptr<MsgSerializer<MsgType>> serializer_;
  std::shared_ptr<MsgQ> msgq_;
};